<?php
if ($_POST['dktm_settings']) {
    unset($_POST['dktm_settings']);
    unset($_POST['Submit']);
    $data = $_POST;
    update_option(DKTM_OPTION_KEY, serialize($data));
    header("Location: admin.php?page=dktm-settings");
    exit;
}
$setting = unserialize(get_option(DKTM_OPTION_KEY));
?>
<div class="wrap">
    <div class="icon32" id="icon-options-general"><br/></div>
    <h2>General Settings</h2>
    <form action="admin.php?page=dktm-settings" method="post">
        <table class="form-table">
            <tbody>
                <tr valign="top">
                    <td scope="row"><label for="setting_network_id">Network pageID:</label></td>
                    <td >
                        <input type="text" class="regular-text" name="network_id" value="<?php echo $setting['network_id']; ?>" id="setting_network_id"/>
                        <span class="description"> (network page id.)</span>
                    </td>
                </tr>
                <tr valign="top">
                    <td scope="row"><label for="setting_make_difference_id">Make a difference pageID:</label></td>
                    <td >
                        <input type="text" class="regular-text" name="make_difference_id" value="<?php echo $setting['make_difference_id']; ?>" id="setting_make_difference_id"/>
                        <span class="description"> (you can make difference page id.)</span>
                    </td>
                </tr>
                <tr valign="top">
                    <td scope="row"><label for="setting_ourgroup_id">Our group pageID:</label></td>
                    <td >
                        <input type="text" class="regular-text" name="ourgroup_id" value="<?php echo $setting['ourgroup_id']; ?>" id="setting_ourgroup_id"/>
                        <span class="description"> (our group or community page id.)</span>
                    </td>
                </tr>
                <tr valign="top">
                    <td scope="row"><label for="setting_entertainment_id">Entertainment pageID:</label></td>
                    <td >
                        <input type="text" class="regular-text" name="entertainment_id" value="<?php echo $setting['entertainment_id']; ?>" id="setting_entertainment_id"/>
                        <span class="description"> (entertainment page id.)</span>
                    </td>
                </tr>
                <tr valign="top">
                    <td scope="row"><label for="setting_jokes_id">Jokes pageID:</label></td>
                    <td >
                        <input type="text" class="regular-text" name="jokes_id" value="<?php echo $setting['jokes_id']; ?>" id="setting_jokes_id"/>
                        <span class="description"> (jokes page id.)</span>
                    </td>
                </tr>
                <tr valign="top">
                    <td scope="row"><label for="setting_games_id">Games pageID:</label></td>
                    <td >
                        <input type="text" class="regular-text" name="games_id" value="<?php echo $setting['games_id']; ?>" id="setting_games_id"/>
                        <span class="description"> (games page id.)</span>
                    </td>
                </tr>
                <tr valign="top">
                    <td scope="row"><label for="setting_phone">Phone:</label></td>
                    <td >
                        <input type="text" class="regular-text" name="phone" value="<?php echo $setting['phone']; ?>" id="setting_phone"/>
                        <span class="description"> (if more phone number need to be added.)</span>
                    </td>
                </tr>
                <tr valign="top">
                    <td scope="row"><label for="setting_email">Email:</label></td>
                    <td >
                        <input type="text" class="regular-text" name="email" value="<?php echo $setting['email']; ?>" id="setting_email"/>
                    </td>
                </tr>
                <tr valign="top">
                    <td scope="row"><label for="setting_facebook">Facebook Url:</label></td>
                    <td >
                        <input type="text" class="regular-text" name="facebook" value="<?php echo $setting['facebook']; ?>" id="setting_facebook"/>
                    </td>
                </tr>
                <tr valign="top">
                    <td scope="row"><label for="setting_twitter">Twitter Url:</label></td>
                    <td >
                        <input type="text" class="regular-text" name="twitter" value="<?php echo $setting['twitter']; ?>" id="setting_twitter"/>
                    </td>
                </tr>
                <tr valign="top">
                    <td scope="row"><label for="setting_instagram">Instagram Url:</label></td>
                    <td >
                        <input type="text" class="regular-text" name="instagram" value="<?php echo $setting['instagram']; ?>" id="setting_instagram"/>
                    </td>
                </tr>
                <tr valign="top">
                    <td scope="row"><label for="setting_linkedin">linkedin Url:</label></td>
                    <td >
                        <input type="text" class="regular-text" name="linkedin" value="<?php echo $setting['linkedin']; ?>" id="setting_linkedin"/>
                    </td>
                </tr>
                <tr valign="top">
                    <td scope="row"><label for="setting_youtube">Youtube Url:</label></td>
                    <td>
                        <input type="text" class="regular-text" name="youtube" value="<?php echo $setting['youtube']; ?>" id="setting_youtube"/>
                    </td>
                </tr>
                <tr valign="top">
                    <td scope="row"><label for="setting_copyright">Copyright Text:</label></td>
                    <td>
                        <textarea name="copyright" id="setting_copyright" style="width: 50%;"><?php echo $setting['copyright']; ?></textarea>
                    </td>
                </tr>
                <tr valign="top">
                    <td scope="row"><label for="setting_network">Network Text:</label></td>
                    <td>
                        <textarea name="network" id="setting_network" style="width: 50%;"><?php echo $setting['network']; ?></textarea>
                    </td>
                </tr>
                <tr valign="top">
                    <td scope="row"><label for="setting_shortcode_home">Home Slider Shortcode</label></td>
                    <td>
                        <textarea name="shortcode_home" id="setting_shortcode_home" style="width: 50%;"><?php echo $setting['shortcode_home']; ?></textarea>
                    </td>
                </tr>
                <tr valign="top">
                    <td scope="row"><label for="setting_shortcode_event">Event Slider Shortcode</label></td>
                    <td>
                        <textarea name="shortcode_event" id="setting_shortcode_event" style="width: 50%;"><?php echo $setting['shortcode_event']; ?></textarea>
                    </td>
                </tr>
            </tbody>
        </table>
        <p class="submit">
            <input type="hidden" value="true" name="dktm_settings">
            <input type="submit" value="Save Changes" class="button-primary" name="Submit"/>
        </p>
    </form>
</div>